From: Marco Trevisan (TreviƱo) Date: Sat, 2 Sep 2017 02:11:39 +0000 (+0200) Subject: st-label: Paint shadow using resource-scaled texture X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~888^2^2~73 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=15f69bdc3b23e9c652aa4c72e16050f594abd526;p=gnome-shell.git st-label: Paint shadow using resource-scaled texture https://bugzilla.gnome.org/show_bug.cgi?id=765011 --- diff --git a/src/st/st-label.c b/src/st/st-label.c index 84e685705..ed68f67f5 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -197,34 +197,52 @@ st_label_paint (ClutterActor *actor) if (shadow_spec) { - ClutterActorBox allocation; - float width, height; + float resource_scale; - clutter_actor_get_allocation_box (priv->label, &allocation); - clutter_actor_box_get_size (&allocation, &width, &height); - - if (priv->text_shadow_pipeline == NULL || - width != priv->shadow_width || - height != priv->shadow_height) + if (clutter_actor_get_resource_scale (priv->label, &resource_scale)) { - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); - - priv->shadow_width = width; - priv->shadow_height = height; - priv->text_shadow_pipeline = _st_create_shadow_pipeline_from_actor (shadow_spec, priv->label); + ClutterActorBox allocation; + float width, height; + + clutter_actor_get_allocation_box (priv->label, &allocation); + clutter_actor_box_get_size (&allocation, &width, &height); + + width *= resource_scale; + height *= resource_scale; + + if (priv->text_shadow_pipeline == NULL || + width != priv->shadow_width || + height != priv->shadow_height) + { + g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + + priv->shadow_width = width; + priv->shadow_height = height; + priv->text_shadow_pipeline = + _st_create_shadow_pipeline_from_actor (shadow_spec, + priv->label); + } + + if (priv->text_shadow_pipeline != NULL) + _st_paint_shadow_with_opacity (shadow_spec, + cogl_get_draw_framebuffer (), + priv->text_shadow_pipeline, + &allocation, + clutter_actor_get_paint_opacity (priv->label)); } - - if (priv->text_shadow_pipeline != NULL) - _st_paint_shadow_with_opacity (shadow_spec, - cogl_get_draw_framebuffer (), - priv->text_shadow_pipeline, - &allocation, - clutter_actor_get_paint_opacity (priv->label)); } clutter_actor_paint (priv->label); } +static void +st_label_resource_scale_changed (StWidget *widget) +{ + StLabelPrivate *priv = ST_LABEL (widget)->priv; + + g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); +} + static void st_label_class_init (StLabelClass *klass) { @@ -243,6 +261,7 @@ st_label_class_init (StLabelClass *klass) actor_class->get_preferred_height = st_label_get_preferred_height; widget_class->style_changed = st_label_style_changed; + widget_class->resource_scale_changed = st_label_resource_scale_changed; widget_class->get_accessible_type = st_label_accessible_get_type; pspec = g_param_spec_object ("clutter-text",